package com.liuqi.iot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.liuqi.common.base.service.AbstractBaseEntityService;
import com.liuqi.iot.bean.dto.AlarmCategoryDTO;
import com.liuqi.iot.bean.query.AlarmCategoryQuery;
import com.liuqi.iot.domain.entity.AlarmCategoryEntity;
import com.liuqi.iot.domain.mapper.AlarmCategoryMapper;
import com.liuqi.iot.service.AlarmCategoryEntityService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 报警分类服务实现 
 * @author Coder Generator 2025-03-24 17:00:27 
 **/
@Service
public class AlarmCategoryEntityServiceImpl extends AbstractBaseEntityService<AlarmCategoryEntity, AlarmCategoryDTO, AlarmCategoryMapper, AlarmCategoryQuery> implements AlarmCategoryEntityService {
    @Override
    protected QueryWrapper<AlarmCategoryEntity> queryToWrapper(AlarmCategoryQuery query) {
        return this.createQueryWrapper()
                .eq(StringUtils.isNotBlank(query.getId()), "id", query.getId())
                .in(null != query.getIds(), "id", query.getIds())
                .orderByDesc("create_time");
    }
}